import Mock from 'mockjs'
import userInfoAdmin from './userInfoAdmin.json'
import userInfoCommon from './userInfoCommon.json'
import adminToken from './adminToken.json'
import commonToken from './commonToken.json'

Mock.mock('/mock/userInfo',"post",(options) =>{
    if(options.body === 'eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAKtWKi5NUrJSSkzJzcxT0lFKrShQsjI0MzIwNbI0MDSqBQD6mzd9IAAAAA.FDsMndSXshkQ54bYBdi1Hq4V6PFEl3tW0PLjykoM-rhpSrudv1BsD5A8GLMxqz8x9Xlr2RLcvYP_nRWTfgVhXw'){
        return userInfoAdmin
    }else{
        return userInfoCommon
    }
})

Mock.mock('/mock/admin/acl/index/login',"post",(options)=>{
    let item =JSON.parse(options.body)
    if(item.username === 'admin'){
        console.log('admin')
        return adminToken
    }else{
        return commonToken
    }
})